﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC3Demo.Controllers
{
   [AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
   public class MultiActionAttribute : ActionNameSelectorAttribute
   {
      public string Name { get; set; }

      public override bool IsValidName(ControllerContext controllerContext, string actionName, System.Reflection.MethodInfo methodInfo)
      {
         if (string.IsNullOrEmpty(Name)) return false;
            
         return controllerContext.HttpContext.Request.Form.AllKeys.Contains(Name);
      }
   }
}